home *** CD-ROM | disk | FTP | other *** search
/ Turnbull China Bikeride / Turnbull China Bikeride - Disc 1.iso / ARGONET / PD / PROGRAMMING / DESKLIBC / SOURCES.ZIP / DeskLib / !DLSources / Libraries / Template / c / Free < prev    next >
Text File  |  1992-03-31  |  2KB  |  48 lines

  1. /*
  2.     ####             #    #     # #
  3.     #   #            #    #       #          The FreeWare C library for 
  4.     #   #  ##   ###  #  # #     # ###             RISC OS machines
  5.     #   # #  # #     # #  #     # #  #   ___________________________________
  6.     #   # ####  ###  ##   #     # #  #                                      
  7.     #   # #        # # #  #     # #  #    Please refer to the accompanying
  8.     ####   ### ####  #  # ##### # ###    documentation for conditions of use
  9.     ________________________________________________________________________
  10.  
  11.     File:    Template.Free.c
  12.     Author:  Copyright © 1992 Jason Williams
  13.              Thanks to John Winters for supplying the code that I hacked
  14.              changed, hacked, rewrote, and then wrote again from scratch!
  15.     Version: 1.10 (29 Mar 1992)
  16.     Purpose: Loading, cacheing, and retrieval of window templates
  17. */
  18.  
  19. #include "TempDefs.h"
  20.  
  21.  
  22.  
  23. extern void Template_Free(window_block **windowdef)
  24. /* Deallocates the memory used by a window definition */
  25. {
  26.   window_block *window;
  27.   icon_block   *icons;
  28.   int          icon;
  29.  
  30.   window = *windowdef;
  31.   if (window->titleflags.data.indirected)
  32.     free(window->title.indirecttext.buffer);
  33.  
  34.   icons = (icon_block *) ((int)window + sizeof(window_block));
  35.   for (icon = 0; icon < window->numicons; icon++)
  36.   {
  37.     if (icons[icon].flags.data.indirected && icons[icon].flags.data.text)
  38.     {
  39.       free(icons[icon].data.indirecttext.buffer);
  40.       if ((int) icons[icon].data.indirecttext.validstring > 0)
  41.         free(icons[icon].data.indirecttext.validstring);
  42.     }
  43.   }
  44.  
  45.   free(window);
  46.   *windowdef = NULL;
  47. }
  48.